package com.xjh.utils.beanutils.internal.convertors;

import com.xjh.utils.beanutils.BeanCopyConvertor;

/**
 * Array转换工厂
 *
 * @company 湖南省安第斯信息科技有限公司, 版权所有
 * @author kevin
 * @date 2021/3/10
 */
public class ArrayConvertorFactory {

	@SuppressWarnings("rawtypes")
	public static BeanCopyConvertor getArrayConvertor(Class<?> methodSourceType, Class<?> methodTargetType, Class<?> propertyOptionClass) {
		
		if( !(methodSourceType.isPrimitive() || methodTargetType.isPrimitive() ) ) {
			return new ObjectArrayConvertor(methodSourceType, methodTargetType, propertyOptionClass);
		}
		
		if( int.class.equals(methodSourceType) ) {
			return new IntArrayConvertor();
		} else if( boolean.class.equals(methodSourceType) ) {
			return new BoolArrayConvertor();
		} else if( byte.class.equals(methodSourceType) ) {
			return new ByteArrayConvertor();
		} else if( char.class.equals(methodSourceType) ) {
			return new CharArrayConvertor();
		} else if( short.class.equals(methodSourceType) ) {
			return new ShortArrayConvertor();
		} else if( long.class.equals(methodSourceType) ) {
			return new LongArrayConvertor();
		} else if( float.class.equals(methodSourceType) ) {
			return new FloatArrayConvertor();
		} else if( double.class.equals(methodSourceType) ) {
			return new DoubleArrayConvertor();
		} else if( Integer.class.equals(methodSourceType) ) {
			return new IntObjectArrayConvertor();
		} else if( Boolean.class.equals(methodSourceType) ) {
			return new BoolObjectArrayConvertor();
		} else if( Character.class.equals(methodSourceType) ) {
			return new CharObjectArrayConvertor();
		} else if( Byte.class.equals(methodSourceType) ) {
			return new ByteObjectArrayConvertor();
		} else if( Short.class.equals(methodSourceType) ) {
			return new ShortObjectArrayConvertor();
		} else if( Long.class.equals(methodSourceType) ) {
			return new LongObjectArrayConvertor();
		} else if( Float.class.equals(methodSourceType) ) {
			return new FloatObjectArrayConvertor();
		} else if( Double.class.equals(methodSourceType) ) {
			return new DoubleObjectArrayConvertor();
		}
		
		return null;
		
	}
	
}
